//
//  FFPayTypeCell.m
//  FFMall
//
//  Created by IT.Bear on 16/5/16.
//  Copyright © 2016年 IT.Bear. All rights reserved.
//

#import "FFPayTypeCell.h"

@interface FFPayTypeCell ()
@property (weak, nonatomic) IBOutlet UIImageView *selectIconWechat;
@property (weak, nonatomic) IBOutlet UIImageView *selectIconAlipay;
@property (weak, nonatomic) IBOutlet UIImageView *selectIconUPPay;

@end

@implementation FFPayTypeCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (void)setSelectIconStatueWithImageView:(UIImageView *)imageView
{
    UIImage *select = [UIImage imageNamed:@"selected"];
    UIImage *selectNo = [UIImage imageNamed:@"unSelected"];
    _selectIconUPPay.image = selectNo;
    _selectIconAlipay.image = selectNo;
    _selectIconWechat.image = selectNo;
    
    imageView.image = select;
}

- (IBAction)payByAlipay:(id)sender {
    [self setSelectIconStatueWithImageView:_selectIconAlipay];
    if (_delegate && [_delegate respondsToSelector:@selector(payTypeCellChoosePayType:)]) {
        [_delegate payTypeCellChoosePayType:FFPayTypeAlipay];
    }
}

- (IBAction)payByWechat:(id)sender {
    [self setSelectIconStatueWithImageView:_selectIconWechat];
    if (_delegate && [_delegate respondsToSelector:@selector(payTypeCellChoosePayType:)]) {
        [_delegate payTypeCellChoosePayType:FFPayTypeWeChatPay];
    }
}

- (IBAction)payByUPPay:(id)sender {
    [self setSelectIconStatueWithImageView:_selectIconUPPay];
    if (_delegate && [_delegate respondsToSelector:@selector(payTypeCellChoosePayType:)]) {
        [_delegate payTypeCellChoosePayType:FFPayTypeUPPay];
    }
}

@end
